package com.open.cloud.rbac.controller.config;

import com.open.cloud.rbac.service.config.ICoreSystemConfigService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author wangzengzhou01
 * @since 2025-01-21
 */
@Api(tags = "RBAC服务-系统配置业务")
@Slf4j
@RestController
@RequestMapping(value = "api/v1/core/system/config")
public class CoreSystemConfigController {

    @Resource
    private ICoreSystemConfigService systemConfigService;


//    @ApiOperation(value = "创建")
//    @PostMapping
//    public Response save(@RequestBody CoreSystemConfig obj) throws Exception {
//        boolean result = service.save(obj);
//        return result ? ResponseFactory.getSuccess() : ResponseFactory.getError();
//    }
//
//    @ApiOperation(value = "更新")
//    @PutMapping("/{id}")
//    public Response update(@PathVariable(name = "id") Integer id, @RequestBody CoreSystemConfig obj) throws Exception {
//        boolean result = service.updateById(obj);
//        return result ? ResponseFactory.getSuccess() : ResponseFactory.getError();
//    }
//
//    @ApiOperation(value = "按ID删除")
//    @DeleteMapping("/{id}")
//    public Response remove(@PathVariable(name = "id") Integer id) throws Exception {
//        boolean result = service.removeById(id);
//        return result ? ResponseFactory.getSuccess() : ResponseFactory.getError();
//    }
//
//    @ApiOperation(value = "按ID查询")
//    @GetMapping("/{id}")
//    public Response select(@PathVariable(name = "id") Integer id) {
//        CoreSystemConfig obj = service.getById(id);
//        return ResponseFactory.getSuccessData(obj);
//    }
//
//    @PostMapping("/dels")
//    @ApiOperation(value = "按ID删除多个")
//    public Response removes(@RequestBody List<Integer> ids) throws Exception {
//        boolean result = service.removeByIds(ids);
//        return result ? ResponseFactory.getSuccess() : ResponseFactory.getError();
//    }
//
//    @PostMapping("/deleteBy")
//    @ApiOperation(value = "条件删除")
//    public Response deleteBy(@RequestBody(required = false) Map<String, String> params) {
//        QueryWrapper<CoreSystemConfig> query = new QueryWrapper<>();
//        //query.like("","");
//        if (!query.isEmptyOfWhere()) {
//            service.remove(query);
//        }
//        return ResponseFactory.getSuccess();
//    }
//
//
//    @PostMapping("/selby")
//    @ApiOperation(value = "条件查询")
//    List<CoreSystemConfig> selectBy(@RequestBody(required = false) Map<String, String> params) {
//        QueryWrapper<CoreSystemConfig> query = new QueryWrapper<>();
//        //query.like("","");
//        List<CoreSystemConfig> objs = service.list(query);
//        return objs;
//    }
//
//    @PostMapping("/selpage")
//    @ApiOperation(value = "分页查询")
//    IPage<CoreSystemConfig> selectPage(@RequestBody Map<String, String> params) {
//        Long pageSize = 10L;
//        Long pageIndex = 0L;
//        String key4PageSize = "pageSize";
//        String key4PageIndex = "pageIndex";
//        if (params.containsKey(key4PageSize) && NumberUtil.isLong(params.get(key4PageSize))) {
//            pageSize = NumberUtil.parseLong(params.get(key4PageSize));
//        }
//        if (params.containsKey(key4PageIndex) && NumberUtil.isLong(params.get(key4PageIndex))) {
//            pageIndex = NumberUtil.parseLong(params.get(key4PageIndex));
//        }
//        QueryWrapper<CoreSystemConfig> query = new QueryWrapper<>();
//        //query.like("","");
//        //if(StringUtils.isNotBlank(params.get("indName"))){
//        // query.like("ind_name", params.get("indName"));
//        // }
//        Page<CoreSystemConfig> page = new Page<CoreSystemConfig>(pageIndex, pageSize);
//        IPage<CoreSystemConfig> result = service.page(page, query);
//        return result;
//    }
}

